package com.familytree.dto;

import com.familytree.model.Member;
import lombok.Data;

import java.time.LocalDate;
import java.util.List;

@Data
public class MemberTreeDTO {
    private Long id;
    private String name;
    private LocalDate birthDate;
    private LocalDate deathDate;
    private String gender;
    private String role;
    private String avatarUrl;
    private LocalDate marriageDate;
    private MemberTreeDTO spouse;
    private List<MemberTreeDTO> children;

    public static MemberTreeDTO fromMember(Member member) {
        if (member == null) {
            return null;
        }

        MemberTreeDTO dto = new MemberTreeDTO();
        dto.setId(member.getId());
        dto.setName(member.getName());
        dto.setBirthDate(member.getBirthDate());
        dto.setDeathDate(member.getDeathDate());
        dto.setMarriageDate((member.getMarriageDate()));
        dto.setGender(member.getGender());
        dto.setRole(member.getRole());
        dto.setAvatarUrl(member.getAvatarUrl());
        return dto;
    }
} 